<?php
	if(isset($_GET['mhd']) && isset($_GET['pin']) && isset($_GET['luong']) && isset($_GET['mgv']) && trim($_GET['mhd']) != '' && trim($_GET['pin']) != '' && trim($_GET['luong']) != '' && trim($_GET['mgv']) != '')
	{
		$MaHopDong  = trim($_GET['mhd']);
		$PIN        = trim($_GET['pin']);
		$Luong      = (int)trim($_GET['luong']);
		$MaGiaoVien = trim($_GET['mgv']);
		
		include_once '../classes/hopdong_bs.php';
		include_once '../classes/giaovien_bs.php';
		$HopDong = new hopdong_bs();
		$HopDong->SetMaHopDong($MaHopDong);
		$HopDong->SetPIN($PIN);
		$DHopDong = $HopDong->LayDanhSach();
		if($DHopDong != null)
		{
			$GiaoVien = new giaovien_bs();
			$GiaoVien->SetMaGiaoVien($MaGiaoVien);
			$DGiaoVien = $GiaoVien->LayDanhSach();
			if($DGiaoVien != null)
			{
				$HoTen = $DGiaoVien[0]['HoTen'];
				$MaNguoiDung = $_SESSION['USER']['MaNguoiDung'];
?>
<div class="FormNhapLieu">
	<div class="Title">
		<h3>
			Lập phiếu chi trả lương giáo viên
		</h3>
	</div>
	<form action="index.php?act=phieuchi_them_sub" method="POST">
		<input type="text" hidden="true" value="<?php echo $MaNguoiDung; ?>" name="MaNguoiDung" />
		<input type="text" hidden="true" value="<?php echo $MaHopDong; ?>" name="MaHopDong" />
		<table class="Fields">
			<tr>
				<td>
					Mã giáo viên
				</td>
				<td>
					<input readonly="true" type="text" name="MaGiaoVien" value="<?php echo $MaGiaoVien; ?>" />
				</td>
			</tr>
			<tr>
				<td>
					Họ tên
				</td>
				<td>
					<input readonly="true" type="text" name="HoTen" value="<?php echo $HoTen; ?>"/>
				</td>
			</tr>
			<tr>
				<td>
					Số tiền
				</td>
				<td>
					<input type="text" name="SoTien" value="<?php echo $Luong; ?>" />
				</td>
			</tr>
		</table>
		<table class="Submit">
			<tr>
				<td>
					<input type="submit" value="Thêm phiếu chi" />
				</td>
				<td>
					<input type="reset" value="Nhập lại tất cả" />
				</td>
			</tr>
		</table>
	</form>
</div>
<?php
			}
			else
				header('Location: index.php?act=bangluong');
		}
		else
			header('Location: index.php?act=bangluong');
	}
	else
		header('Location: index.php?act=bangluong');
?>